package com.zf.dao;

import com.zf.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    //查询全部用户


    @Select("select * from mybatis.user")
    List<User> getUsers();

    @Select("select * from mybatis.user where id = #{id}")
        // 方法存在多个参数，所有的参数前面必须加上 @Param("id")注解
    User getUserById(@Param("id") int id);

    @Insert("insert into mybatis.user(id,name,pwd) values(#{id},#{name},#{pwd})")
    int addUser(User user);

    @Update("update mybatis.user set name=#{name},pwd=#{pwd} where id = #{id}")
    int updateUser(User user);

    @Delete("delete from mybatis.user where id = #{uid}")
    int delUser(@Param("uid") int id);



}
